<template>

	<view class="">

		<u-grid :col="3" v-if="lyType == 1" :border="false">

			<u-grid-item :customStyle="{
					'padding': '30rpx 0',
					'flex-direction': 'row',
					'align-items': 'center',
				}" v-for="(item, index) in workdatalist" :key="index" @click="layout1Click(item.code)">

				<image class="layout1-image" :src="getImgUrl(item.defaultIcon)" mode="scaleToFill"></image>
				<view class="layout1-text">
					<text>{{item.count}}</text>
					<text>{{item.name}}</text>
				</view>

			</u-grid-item>

		</u-grid>

		<u-grid :col="4" v-if="lyType == 2" :border="false" :customStyle="{
				'padding': '20rpx 0',
			}">

			<u-grid-item v-for="(item, index) in workdatalist" :key="index" :customStyle="{
				'margin': '10rpx 0',
			}" @click="layout2Click(item.code)">

				<view class="layout2-circle">
					<text>{{item.count}}</text>
				</view>

				<text class="layout2-text">{{item.name}}</text>

			</u-grid-item>

		</u-grid>

		<u-grid :col="4" v-if="lyType == 3" :border="false" :customStyle="{
				'padding': '20rpx 0',
			}">

			<u-grid-item v-for="(item, index) in workdatalist" :key="index" @click="layout3Click(item.code)">

				<image class="layout3-image" :src="getImgUrl(item.defaultIcon)" mode=""></image>

				<text class="layout3-text">{{item.name}}</text>

			</u-grid-item>

		</u-grid>

		<u-grid :col="3" v-if="lyType == 4" :border="false" :customStyle="{
				'padding': '10rpx',
			}">

			<u-grid-item v-for="(item, index) in workdatalist" :key="index"
				:customStyle="{border:'solid white 10rpx', padding: '0' }" @click="layout4Click(item.code)">

				<image class="layout4-image" :src="getImgUrl(item.defaultIcon)" mode=""></image>
			</u-grid-item>

		</u-grid>

		<u-grid :col="2" v-if="lyType == 5" :border="false" :customStyle="{
				'padding': '10rpx',
			}">

			<u-grid-item :customStyle="{border:'solid white 10rpx', padding: '0' }"
				v-for="(item, index) in workdatalist" :key="index" @click="layout5Click(item.code)">

				<image class="layout5-image" :src="getImgUrl(item.defaultIcon)" mode=""></image>
			</u-grid-item>

		</u-grid>

		<u-grid :col="2" v-if="lyType == 6" :border="false" :customStyle="{
				'padding': '10rpx',
			}">

			<u-grid-item :customStyle="{border:'solid white 10rpx', padding: '0' }"
				v-for="(item, index) in workdatalist" :key="index" @click="layout6Click(item.code)">

				<image class="layout5-image" :src="getImgUrl(item.defaultIcon)" mode=""></image>
			</u-grid-item>

		</u-grid>


	</view>

</template>

<script>
	import imageload from '../../mixins/imageload.js';

	export default {
		mixins: [imageload],
		name: "workContentItem",
		props: {
			lyType: {
				type: Number,
				default: 0
			},
			workdatalist: {
				type: Array,
				default: () => {
					return [];
				}
			}
		},

		data() {
			return {
				timeout: null,
			}
		},

		methods: {
			layout1Click(code) {
				//待办
				switch (code) {
					case "1": //待我审批
						uni.navigateTo({
							url: '/pagesB/approval/approval-center?bigType=1'
						})
						break;
					case "2": //抄送我的
						uni.navigateTo({
							url: '/pagesB/approval/approval-center?bigType=2'
						})
						break;
					case "3": //我发起的
						uni.navigateTo({
							url: '/pagesB/approval/approval-center?bigType=3'
						})
						break;
				}

			},
			layout2Click(code) {
				//提醒事件

				switch (code) {
					case "1": //待保险
						uni.navigateTo({
							url: '../../pages/renewal/renewallist'
						})
						break;
					case "2": //待年检
						uni.navigateTo({
							url: '../../pages/yearcheck/yearcheck'
						})
						break;
					case "3": //待保养
						uni.navigateTo({
							url: '../../pages/maintain/maintain'
						})
						break;
					case "4": //有违章
						uni.navigateTo({
							url: '../../pages/illegal/illegal'
						})
						break;
					case "5": //租赁到期
						uni.navigateTo({
							url: '../../pages/rentdue/rentdue'
						})
						break;
					case "6": //逾期欠款
						uni.navigateTo({
							url: '../../pages/overdue/overdue'
						})
						break;
					case "7": //GPS离线
						uni.navigateTo({
							url: '../../pages/offline/offline'
						})
						break;
					case "8": //围栏报警
						uni.navigateTo({
							url: '../../pages/railwarn/railwarn'
						})
						break;
					case "9": //退款提醒
						uni.navigateTo({
							url: '../../pages/refundwarn/refundwarn'
						})
						break;
					case "10": //预约记录
						uni.navigateTo({
							url: '../../pages/maintenanceAppointment/maintenanceAppointment'
						})
						break;
				}
			},

			layout3Click(code) {
				//日常工具
				switch (code) {
					case "1": //违章查询
						uni.navigateTo({
							// url: '/pagesA/queryillegal/queryillegal'
							url: '/pages/illegal/queryillegallist'
						})
						break;
					case "3": //驾照查询
						uni.navigateTo({
							url: '/pagesA/querydrivecard/querydrivecard'
						})
						break;
				}
			},
			layout4Click(code) {
				//车辆管理
				switch (code) {
					case "1": //新增车辆
						uni.navigateTo({
							url: '../../pages/addCar/addCar-bassicInfo'
						})
						break;
					case "2": //车辆库存
						uni.navigateTo({
							url: '../../pages/car/inventory/car-inventory'
						})
						break;
					case "3": //车辆调拨
						uni.navigateTo({
							url: '../../pages/car/allocation/car-allocation'
						})
						break;
					case "13": //新增维修
						uni.navigateTo({
							url: '../../pages/car/repair/car-repair'
						})
						break;
					case "14": //新增出险
						uni.navigateTo({
							url: '../../pages/car/outdanger/car-outdanger'
						})

						break;
				}
			},
			layout5Click(code) {
				//销售管理
				switch (code) {
					case "1": //新增线索
						console.log("点击了");
						uni.navigateTo({
							url: '../../pages/clue/clue-add'
						})
						break;
					case "2": //销售线索
						uni.navigateTo({
							url: '../../pages/clue/clue-list'
						})
						break;
					case "3": //新增车辆订单
						uni.navigateTo({
							url:'/pagesB/addorder/addorder-seltype'
						})
						break;
					case "4": //客户管理
						uni.navigateTo({
							url: '../../pages/customer/customer-center'
						})
						break;
				}
			},
			layout6Click(code) {
				//渠道管理
				switch (code) {
					case "13": //新增渠道
						// this.$u.toast('新增渠道')
						uni.navigateTo({
							url: '/pagesA/channel/addchannel'
						})
						break;
					case "14": //渠道管理
						// this.$u.toast('渠道管理')
						uni.navigateTo({
							url: '/pagesA/channel/channel-list'
						})
						break;
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	u-grid {
		flex-direction: row;
	}

	// .layout1 {
	// display: inline-flex;
	// flex-direction: row;
	// margin: 0 20rpx;
	// height: 240rpx;
	// align-items: center;
	// flex-grow: 1;

	.layout1-image {
		width: 60rpx;
		height: 60rpx;
	}

	.layout1-text {
		display: inline-flex;
		justify-content: center;

		margin-left: 10rpx;
		display: inline-flex;
		flex-direction: column;
		font-size: 24rpx;

	}

	// }

	// .layout2 {
	// max-height: 150rpx;
	// padding: 0rpx 0;

	.layout2-circle {
		width: 85rpx;
		height: 85rpx;
		background-image: linear-gradient(135deg, #F3F8FE, #A2C7FF);
		border-radius: 50%;
		display: inline-flex;
		align-items: center;
		justify-content: center;

		text {
			color: $blue15;
		}
	}

	.layout2-text {
		font-size: 26rpx;
		color: $black33;
		margin-top: 8rpx;

	}

	// }

	// .layout3 {
	.layout3-image {
		width: 60rpx;
		height: 60rpx;
	}

	.layout3-text {
		font-size: 24rpx;
		color: $black33;
		margin-top: 8rpx;
	}

	// }

	// .layout4 {
	.layout4-image {
		width: 100%;
		height: 240rpx;
	}

	// }

	// .layout5 {
	.layout5-image {
		width: 100%;
		height: 140rpx;
	}

	// }
</style>
